package com.ctrip.payment.domain.base;

import com.ctrip.payment.domain.PageParamer;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@MappedSuperclass
public abstract class BaseJpaEntity implements Serializable {

    public static final String DEL_YES = "1";
    public static final String DEL_NO = "0";

    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    protected Long id;

    @Column(name="create_date")
    @ApiModelProperty("创建时间")
    @JsonFormat(timezone = "GMT+08", pattern = "yyyy-MM-dd HH:mm:ss") // 返回格式化的字符串
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") // 接收格式化的字符串，转为Date类型对象
    protected Date createDate;

    @Column(name="create_user", length = 64)
    @ApiModelProperty("创建人")
    protected String createUser;

    @Column(name="update_date")
    @ApiModelProperty("更新时间")
    @JsonFormat(timezone = "GMT+08", pattern = "yyyy-MM-dd HH:mm:ss") // 返回格式化的字符串
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") // 接收格式化的字符串，转为Date类型对象
    protected Date updateDate;

    @Column(name="update_user", length = 64)
    @ApiModelProperty("更新人")
    protected String updateUser;

    @Column(name="remarks", length = 2500)
    @ApiModelProperty("备注")
    private String remarks;

    @Column(name="del_flag", length = 1)
    @ApiModelProperty("删除标识")
    protected String delFlag = DEL_NO;

    @ApiModelProperty(value = "分页对象")
    protected transient PageParamer pageParamer;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public String getUpdateUser() {
        return updateUser;
    }

    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }

    public String getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public BaseJpaEntity() {
    }

    public PageParamer getPageParamer() {
        return pageParamer;
    }

    public void setPageParamer(PageParamer pageParamer) {
        this.pageParamer = pageParamer;
    }
}
